/**
 * 0541
 *  
 * @Author : roryrywang
 * @DateTime : 2024/8/13 22:33
 */

#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    string reverseStr(string s, int k) {
        if (k == 1) return s;
        int idx = 0;
        while (idx + k <= s.size()) {
            for (int i = idx, j = idx + k - 1; i < j; ++i, --j) {
                swap(s[i], s[j]);
            }
            idx += 2 * k;
        }
        for (int i = idx, j = s.size() - 1; i < j; ++i, --j) {
            swap(s[i], s[j]);
        }
        return s;
    }
};

int main() {

    return 0;
}